<template>
  <div class="app-container">
		<div class="filter-container clearfix">
			<right-toolbar @queryTable="getData" />
		</div>
    <el-table :data="tableData" style="width: 100%" border v-loading="loading">
      <el-table-column label="序号" align="center" width="50">
        <template slot-scope="scope">
          {{ (queryParams.page - 1) * queryParams.pageSize + scope.$index + 1 }}
        </template>
      </el-table-column>
      <el-table-column
        header-align="center"
        align="center"
        prop="year"
        label="年份"
      ></el-table-column>
      <el-table-column
        header-align="center"
        align="center"
        prop="monthCount"
        label="统计月份数"
      ></el-table-column>
      <el-table-column
        header-align="center"
        align="center"
        prop="sumSalaryMicrometer"
        label="工资合计"
      ></el-table-column>
      <el-table-column
        header-align="center"
        align="center"
        prop="avgSalaryMicrometer"
        label="平均工资"
      ></el-table-column>
      <el-table-column
        header-align="center"
        align="center"
        prop="sumBenefitsMicrometer"
        label="节日福利"
      ></el-table-column>
      <el-table-column
        header-align="center"
        align="center"
        prop="sumSalaryWithBenefitsMicrometer"
        label="工资合计(含节日福利)"
      ></el-table-column>
      <el-table-column
        header-align="center"
        align="center"
        prop="avgSalaryWithBenefitsMicrometer"
        label="平均工资(含节日福利)"
      ></el-table-column>
    </el-table>
		<Pagination
      v-show="totalCount>0"
			:total="totalCount"
      :page.sync="queryParams.page"
      :limit.sync="queryParams.pageSize"
      @pagination="getData"
		/>
  </div>
</template>

<script>
export default {
  name: 'SalaryAnalyze',
  data() {
    return {
      tableData: null,
      totalCount: 0,
      queryParams: {
        page: 1,
        pageSize: 10,
      },
      loading: true
    }
  },
  created() {
    this.getData()
  },
  methods: {
    getData() {
      this.loading = true;
      this.getRequest('/salary/analyze/', this.queryParams).then((resp) => {
        this.tableData = resp.data.list;
				this.totalCount = Number(resp.data.total);
        this.loading = false;
      })
    },
  },
}
</script>

<style lang="scss" scoped>
	.filter-container{
		padding-top: 0;
	}
</style>
